/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBean;

import entities.Article;
import entities.ArticleState;
import entities.UserProject;
import interfaces.ArticleInterface;
import interfaces.UserProjectInterface;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author Thibault
 */
@ManagedBean
@SessionScoped
public class MyAuction implements Serializable {

    @EJB
    private UserProjectInterface userEJB;
    private String selectedState = "All";
    private Article selectedArticle;

    public List<Article> getListAuction() {
        FacesContext fc = FacesContext.getCurrentInstance();
        UserProject loggedUser = ((HeaderBean) fc.getExternalContext().getSessionMap()
                .get("headerBean")).getLoggedUser();
        return userEJB.getListAriticleWithBidForUser(loggedUser.getId());
    }

    public String getSelectedState() {
        return selectedState;
    }

    public Article getSelectedArticle() {
        return selectedArticle;
    }

    public void setSelectedArticle(Article selectedArticle) {
        this.selectedArticle = selectedArticle;
    }
}
